package com.lsec.springbootinit.model.common;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Min;
import lombok.Data;
import org.hibernate.validator.constraints.Range;

import java.io.Serializable;


/**
 * 通用分页表单
 *
 * @author Cherry
 * @date 2023-03-03 14:42
 */
@Data
@Schema(description="分页参数")
public class PageParam implements Serializable {

    private static final Integer PAGE = 1;
    private static final Integer PAGE_SIZE = 10;

    /**
     * 页码
     */
    @Min(value = 1, message = "页码输入有误")
    @Schema(description = "页码", example = "1")
    private Integer page = PAGE;

    /**
     * 每页显示的数量
     */
    @Range(min = 1, max = 200, message = "每页显示的数量输入有误")
    @Schema(description = "每页显示的数量", example = "10")
    private Integer pageSize = PAGE_SIZE;

}